package pers.supeijin.devtools.converter.entity;

import com.intellij.openapi.vfs.VirtualFile;

/**
 * @author supeijin
 */
public class WexinFileInfo implements OnConverterListener {
	private String fileName;
	private VirtualFile wxmlFile;
	private VirtualFile lessFile;
	private VirtualFile jsonFile;
	private VirtualFile jsFile;
	private VirtualFile wxssFile;

	public WexinFileInfo(String fileName) {
		this.fileName = fileName;
	}
	@Override
	public void updateVirtualFile(VirtualFile file){
		if(file!=null){
			String fileName = file.getName();
			if(fileName.endsWith(".less")){
				lessFile=file;
			}else if(fileName.endsWith(".js")){
				jsFile=file;
			}else if(fileName.endsWith(".json")){
				jsonFile=file;
			} else if(fileName.endsWith(".wxss")){
				wxssFile=file;
			} else if(fileName.endsWith(".wxml")){
				wxmlFile=file;
			}
		}
	}
	@Override
	public boolean isEnable(){
		if(wxmlFile!=null){
			return  true;
		}
		return  false;
	}

	public String getFileName() {
		return fileName;
	}

	public VirtualFile getWxmlFile() {
		return wxmlFile;
	}

	public VirtualFile getLessFile() {
		return lessFile;
	}

	public VirtualFile getJsonFile() {
		return jsonFile;
	}

	public VirtualFile getJsFile() {
		return jsFile;
	}

	public VirtualFile getWxssFile() {
		return wxssFile;
	}
}
